﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace igflow
{
    public static class GUI
    {
        static SpriteBatch spriteBatch;
        static List<textObject> text;
        internal static void Init(GraphicsDevice device)
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(device);
            text = new List<textObject>();
         
        }

        internal static void Begin()
        {
            // Start the spritebatch
                spriteBatch.Begin();
                began = true;
        }

        class textObject
        {
            public string text;
            public Vector2 position;
            public Color color;
            public textObject(string text, Vector2 pos, Color col)
            {
                this.text = text;
                this.position = pos;
                this.color = col;
            }

        }

        internal static void Draw(string t, Vector2 pos, Color col)
        {
            text.Add(new textObject(t, pos, col));
        }
        public static bool began = false;
        internal static void Draw()
        {

                Begin();
                if (began)
                {
                    foreach (textObject t in text)
                    {
                        spriteBatch.DrawString(Fonts.normal, t.text, t.position, t.color);
                    }
                }
                End();
        }
        internal static void End()
        {
            if (began)
            {
                // Clear the text labels
                text.Clear();
                // Stop the spritebatch
                spriteBatch.End();

                began = false;
            }
        }

        public static Vector2 ScreenLeft
        {
            get
            {
                return new Vector2(0, 0);
            }
        }


    }

}
